/* 移动端响应式设计 - 优化版 */

/* 媒体查询断点定义 */
:root {
  --breakpoint-mobile: 480px;
  --breakpoint-tablet: 768px;
  --breakpoint-desktop: 1024px;
  --breakpoint-large: 1200px;
}

/* DiaryView 响应式调整 - 平板设备 */
@media (min-width: 481px) and (max-width: 768px) {
  .header-actions {
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
  }
  
  .create-diary-btn,
  .encrypt-btn {
    width: 100%;
    padding: 12px 20px;
  }
  
  .diary-form {
    padding: 20px 16px;
  }
  
  .form-group {
    margin-bottom: 20px;
  }
  
  .emotion-selector {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  
  .emotion-option {
    padding: 12px 8px;
  }
  
  .diary-entries {
    padding: 0;
  }
  
  .entry-card {
    margin: 12px 0;
    padding: 16px;
  }
  
  .entry-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .member-tag {
    font-size: 12px;
    padding: 4px 8px;
  }
  
  .entry-actions {
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
  }
  
  .action-btn {
    padding: 6px 12px;
    font-size: 14px;
  }
}

/* UserCenterView 响应式调整 - 平板设备 */
@media (min-width: 481px) and (max-width: 768px) {
  .profile-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
  }
  
  .user-info {
    margin: 16px 0;
  }
  
  .function-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  
  .function-card,
  .member-entry-card {
    padding: 16px 8px;
  }
  
  .function-card .icon,
  .member-entry-card .icon {
    font-size: 24px;
    margin-bottom: 8px;
  }
  
  .function-card span,
  .member-entry-card span {
    font-size: 12px;
  }
  
  .member-badge {
    font-size: 14px;
    padding: 6px 12px;
    margin-top: 8px;
  }
}

/* 通用响应式样式 */
/* 手机设备 (小于480px) */
@media (max-width: 480px) {
  /* 容器和边距调整 */
  .container,
  .user-center,
  .member-center,
  .diary-view,
  .emotion-analysis-view {
    padding: 12px;
    margin: 0;
    min-width: 100%;
  }
  
  /* 标题样式调整 */
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.3rem; }
  h4, h5, h6 { font-size: 1.1rem; }
  
  /* 按钮样式调整 - 更大的触摸区域 */
  button {
    padding: 14px 20px;
    font-size: 16px;
    min-width: 44px;
    min-height: 44px;
  }
  
  .member-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 18px;
  }
  
  /* 文本大小调整 */
  p {
    font-size: 14px;
    line-height: 1.6;
  }
}

/* 平板设备 (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  /* 容器和边距调整 */
  .container,
  .user-center,
  .member-center,
  .diary-view,
  .emotion-analysis-view {
    padding: 16px;
    margin: 0;
    min-width: 100%;
  }
  
  /* 标题样式调整 */
  h1 { font-size: 2rem; }
  h2 { font-size: 1.7rem; }
  h3 { font-size: 1.5rem; }
  h4, h5, h6 { font-size: 1.2rem; }
  
  /* 按钮样式调整 - 更大的触摸区域 */
  button {
    padding: 12px 20px;
    font-size: 16px;
  }
  
  .member-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 18px;
  }
}

/* UserCenterView 响应式调整 - 手机设备 */
@media (max-width: 480px) {
  .profile-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
  }
  
  .user-info {
    margin: 16px 0;
  }
  
  .function-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .function-card,
  .member-entry-card {
    padding: 12px 6px;
  }
  
  .function-card .icon,
  .member-entry-card .icon {
    font-size: 20px;
    margin-bottom: 6px;
  }
  
  .function-card span,
  .member-entry-card span {
    font-size: 11px;
  }
  
  .member-badge {
    font-size: 14px;
    padding: 6px 12px;
    margin-top: 8px;
  }
}

/* MemberCenterView 响应式调整 */
@media (max-width: 768px) {
  .member-banner {
    padding: 30px 20px;
    text-align: center;
  }
  
  .banner-title {
    font-size: 24px;
    line-height: 1.4;
  }
  
  .banner-subtitle {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
  }
  
  .benefits-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .member-benefit-card {
    padding: 20px;
  }
  
  .benefit-icon {
    font-size: 36px;
    margin-bottom: 12px;
  }
  
  .benefit-title {
    font-size: 18px;
    margin-bottom: 8px;
  }
  
  .benefit-desc {
    font-size: 14px;
    line-height: 1.6;
  }
  
  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .member-plan-card {
    padding: 24px 20px;
  }
  
  .member-price {
    font-size: 32px;
    margin-bottom: 16px;
  }
  
  .plan-features {
    margin: 20px 0;
  }
  
  .plan-features li {
    font-size: 14px;
    padding: 8px 0;
  }
}

/* DiaryView 响应式调整 - 手机设备 */
@media (max-width: 480px) {
  .header-actions {
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
  }
  
  .create-diary-btn,
  .encrypt-btn {
    width: 100%;
    padding: 12px 20px;
  }
  
  .diary-form {
    padding: 20px 16px;
  }
  
  .form-group {
    margin-bottom: 20px;
  }
  
  .emotion-selector {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  
  .emotion-option {
    padding: 12px 8px;
  }
  
  .diary-entries {
    padding: 0;
  }
  
  .entry-card {
    margin: 12px 0;
    padding: 16px;
  }
  
  .entry-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .member-tag {
    font-size: 12px;
    padding: 4px 8px;
  }
  
  .entry-actions {
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
  }
  
  .action-btn {
    padding: 6px 12px;
    font-size: 14px;
  }
}

/* EmotionAnalysisView 响应式调整 */
@media (max-width: 768px) {
  .analysis-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .analysis-content {
    flex-direction: column;
    gap: 24px;
  }
  
  .analysis-left,
  .analysis-right {
    width: 100%;
  }
  
  .emotion-stats {
    padding: 16px;
  }
  
  .stat-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .member-guide-overlay .member-guide-content {
    margin: 20px;
    padding: 20px;
    border-radius: 16px;
  }
  
  .guide-actions {
    flex-direction: column;
    gap: 12px;
  }
  
  .guide-actions button {
    width: 100%;
    padding: 12px 20px;
  }
}

/* 移动端会员提示浮层调整 */
@media (max-width: 768px) {
  .member-prompt-overlay .member-prompt,
  .member-guide-overlay .member-guide-content {
    margin: 20px;
    padding: 24px 20px;
    width: auto;
    max-width: none;
  }
  
  .member-prompt h3,
  .member-guide-content h3 {
    font-size: 20px;
    margin-bottom: 12px;
  }
  
  .member-prompt p,
  .member-guide-content p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
  }
  
  .prompt-actions,
  .guide-actions {
    flex-direction: column;
    gap: 12px;
  }
  
  .prompt-actions button,
  .guide-actions button {
    width: 100%;
    padding: 14px 20px;
  }
}

/* 移动端滚动条优化 */
@media (max-width: 768px) {
  .member-scrollbar {
    -webkit-overflow-scrolling: touch;
  }
  
  .member-scrollbar::-webkit-scrollbar {
    width: 6px;
  }
}

/* 移动端动画优化 */
@media (max-width: 768px) {
  .member-benefit-card:hover {
    transform: translateY(-4px);
  }
  
  .member-plan-card:hover {
    transform: translateY(-4px) scale(1.01);
  }
  
  @keyframes petalFall {
    0% {
      opacity: 0;
      transform: translateY(-30px) rotate(0deg);
    }
    20% {
      opacity: 1;
    }
    100% {
      opacity: 0;
      transform: translateY(80vh) rotate(360deg);
    }
  }
  
  .petal {
    width: 15px;
    height: 15px;
  }
}

/* 平板设备响应式调整 (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .benefits-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .function-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 确保在所有设备上的一致体验 */
* {
  box-sizing: border-box;
  touch-action: manipulation; /* 优化移动端点击体验 */
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%; /* 防止iOS缩放文本 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 480px) {
  html {
    font-size: 13px;
  }
}

@media (max-width: 768px) and (min-width: 481px) {
  html {
    font-size: 14px;
  }
}

/* 优化移动端触摸区域 */
a, button, input, select, textarea {
  touch-action: manipulation;
}

a, button, .btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 移动端表单优化 */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px; /* 防止iOS缩放 */
    padding: 12px;
    width: 100%;
    border-radius: var(--radius-md);
  }
  
  /* 修复iOS中按钮点击延迟 */
  button, .btn {
    -webkit-tap-highlight-color: transparent;
  }
}

/* 响应式图片和媒体 */
img, video, embed, object {
  max-width: 100%;
  height: auto;
}

/* 优化横向滚动 */
.horizontal-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: -ms-autohiding-scrollbar;
}

.horizontal-scroll::-webkit-scrollbar {
  height: 6px;
}

/* 响应式工具类 */
.hide-mobile {
  display: block;
}

.show-mobile {
  display: none;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }
  
  .show-mobile {
    display: block;
  }
  
  /* 简化版布局 */
  .simplify-mobile {
    flex-direction: column;
    gap: 16px;
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  :root {
    --text-color: #000000;
    --background-color: #ffffff;
  }
}

/* 减少动画偏好设置支持 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}